package com.huishen.edrivenew.bean;

import org.json.JSONObject;

import com.google.gson.Gson;
import com.huishen.edrivenew.base.BaseBean;

/**
 * 约课当天信息
 * @author wu
 *
 */

public class LessInfoBean extends BaseBean {
    
    public int cohId;
    public int countlessinfo;   //已被预约数
    public int kmcount; //可以被预约总数
    
    public String lessonDate;
    public String timeFrame;
    
    public int lessonInfoId;
    
    public int id;
    
    // 已约课人数
    public int count;
    
    /**
     * 2|3：科目
     */
    public int subject;
    
    /**
     * 1上午  2下午  3晚上
     */
    public int timeType;
    /**
     * 1-可以取消，2-可以点击评价， 3-已取消 ，4-已评价
     *  status= 2|4可看详情
     *
     *  -1 不可点击； 0 可点击； 1 已预约；2 已约满;
     */
    public int status;
    
    public String name;


    public LessInfoBean() {}

    public LessInfoBean(String name) {
        this.name = name;
    }

    public void setname() {
        switch (this.timeType) {
            case 1:
                this.name = "上午";
                break;
            case 2:
                this.name = "下午";
                break;
            case 3:
                this.name = "晚上";
                break;
        }
    }
    
    public String getTimeName() {
        switch (this.timeType) {
            case 1:
                return "上午";
            case 2:
                return "下午";
            case 3:
                return "晚上";
        }
        return "";
    }
    

    
    public boolean isTheDay(String date) {
        
        return date!=null && date.equals(lessonDate);
    }
    
    
    public static BaseBean parseJson(JSONObject jsonObj) {
        Gson gson = new Gson();
        
        LessInfoBean bean = gson.fromJson(jsonObj.toString(), LessInfoBean.class);
        
        return bean;
    }
    
}
